<template>
	<view class="tab-page group">
		<nav-header title="友商群">
			<template #right>
				<view class="nav-search">
					<uni-search-bar v-model="searchText" cancelButton="none" placeholder="搜索"></uni-search-bar>
				</view>
			</template>
		</nav-header>
		<view v-if="groupStore.businessGroup().length == 0">
			<up-empty :icon="getResource('/icon/empty-message.svg')" text="暂无数据">
			</up-empty>
		</view>
		<view class="group-items" v-else>
			<scroll-view class="scroll-bar" scroll-with-animation="true" scroll-y="true">
				<view v-for="group in groupStore.businessGroup()" :key="group.id">
					<!-- #ifndef APP-PLUS -->
					<group-item v-if="!group.quit && group.showGroupName.includes(searchText)" :group="group"
						:sourceType="$enums.privateMessageType.BUSINESS"></group-item>
					<!-- #endif -->
					<!-- #ifdef APP-PLUS -->
					<group-item v-if="!group.quit && group.showGroupName.includes(searchText)" :group="group"
						:sourceType="1"></group-item>
					<!-- #endif -->
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				searchText: ""
			}
		},
		methods: {
			onFocusSearch() {

			},
			onCreateNewGroup() {
				uni.navigateTo({
					url: "/pageSubOne/group/group-edit"
				})
			}
		}

	}
</script>

<style lang="scss" scoped>
	.group {
		position: relative;
		border: #dddddd solid 1px;
		display: flex;
		flex-direction: column;
		
		.nav-search {
			width: 100px;
			height: 100%;
			/* #ifndef MP-WEIXIN */
			padding-top: 20rpx;
			/* #endif */
		}

		.nav-bar {
			padding: 2rpx 10rpx;
			display: flex;
			align-items: center;
			background-color: white;

			.nav-search {
				flex: 1;
			}

			.nav-add {
				cursor: pointer;
			}
		}
	}
</style>